package Game;

import java.util.Scanner;

/**
 * 玩家类
 */
public class Player extends Role {
    @Override
    public void punch() {
        Scanner scan = new Scanner(System.in);
        while (true) {
            try {
                System.out.println("请出拳：0石头，1剪刀，2布");
                int num = scan.nextInt();
                if (num >= 0 && num <= 2) {
                    this.setNumber(num);
                    break;
                } else {
                    System.out.println("请输入0--2");
                }
            } catch (Exception e) {
                System.out.println("请输入0--2");
                scan.next();
            }
        }

    }
}
